home *** CD-ROM | disk | FTP | other *** search
/ Aminet 32 / Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso / Aminet / disk / misc / ADFlib.lha / Lib / adf_link.c < prev    next >
C/C++ Source or Header  |  1999-05-24  |  1KB  |  69 lines

  1. /*
  2.  * ADF Library
  3.  *
  4.  * adf_link.c
  5.  *
  6.  */
  7.  
  8. #include<string.h>
  9.  
  10. #include"adf_defs.h"
  11. #include"adf_str.h"
  12. #include"adf_link.h"
  13. #include"adf_dir.h"
  14.  
  15. extern struct Env adfEnv;
  16.  
  17. /*
  18.  *
  19.  *
  20.  */
  21. char* path(struct Volume *vol, SECTNUM parent)
  22. {
  23.     struct bEntryBlock entryBlk;
  24.     char *tmpPath;
  25.     int len;
  26.  
  27.     tmpPath = NULL;
  28.     adfReadEntryBlock(vol, parent, &entryBlk);
  29.     len = min(entryBlk.nameLen, MAXNAMELEN);
  30.     memcpy(tmpPath,entryBlk.name,len);
  31.     tmpPath[len]='\0';
  32. /*    if (entryBlk.parent!=vol->rootBlock) {
  33.         return(strcat(path(vol,entryBlk.parent), tmpPath));
  34.     }
  35.     else
  36.    */     return(tmpPath);
  37. }
  38.  
  39.  
  40. /*
  41.  *
  42.  *
  43.  */
  44. RETCODE adfBlockPtr2EntryName(struct Volume *vol, SECTNUM nSect, SECTNUM lPar, 
  45.     char **name, long *size)
  46. {
  47.     struct bEntryBlock entryBlk;
  48.     struct Entry entry;
  49.  
  50.     if (*name==0) {
  51.         adfReadEntryBlock(vol, nSect, &entryBlk);
  52.         *size = entryBlk.byteSize;
  53. return RC_OK;
  54.         adfEntBlock2Entry(&entryBlk, &entry);    //error
  55. /*        if (entryBlk.secType!=ST_ROOT && entry.parent!=lPar)
  56.             printf("path=%s\n",path(vol,entry.parent));
  57. */
  58.        *name = strdup("");
  59.         if (*name==NULL)
  60.             return RC_MALLOC;
  61.         return RC_OK;
  62.     }
  63.     else
  64.  
  65.     return RC_OK;
  66. }
  67.  
  68. /*##################################################################################*/
  69.